package itheima.com.exam.zy5;

public class Student {
//    属性有姓名name、int类型的物理成绩physic、int类型的化学成绩chemistry
    private String name;
    private int physic;
    private int chemistry;

    public Student() {
    }

    public Student(String name, int physic, int chemistry) {
        this.name = name;
        this.physic = physic;
        this.chemistry = chemistry;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getPhysic() {
        return physic;
    }

    public void setPhysic(int physic) {
        this.physic = physic;
    }

    public int getChemistry() {
        return chemistry;
    }

    public void setChemistry(int chemistry) {
        this.chemistry = chemistry;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", physic=" + physic +
                ", chemistry=" + chemistry +
                '}';
    }

    public int getTotal() {
        return physic + chemistry;
    }
}
